﻿namespace StringsAndTextProcessing
{
    using System;
    using System.Collections.Generic;

    class WordsRepetitions
    {
        // 1.2.13.22. Write a program that reads a string from the console and lists all different words in
        // the string along with information how many times each word is found.

        static void Main()
        {
            var text = Console.ReadLine();
            var splittedWords = text.Split(new char[] { ' ', '.', ',' }, StringSplitOptions.RemoveEmptyEntries);

            var dicty = new Dictionary<string, int>();

            foreach (var word in splittedWords)
            {
                if (dicty.ContainsKey(word) == true)
                {
                    dicty[word] = dicty[word] + 1;
                }
                else
                {
                    dicty.Add(word, 1);
                }
            }

            foreach (var word in dicty)
            {
                Console.WriteLine("{0} -> {1}", word.Key, word.Value);
            }
        }
    }
}